package marinagosson.ti.trabalho.database;

import java.sql.SQLException;

import com.j256.ormlite.jdbc.JdbcConnectionSource;
import com.j256.ormlite.support.ConnectionSource;
  
public class ConnectionFactory { 
      
    private static String url = "jdbc:mysql://localhost:3308/trabalhoti?user=root&password=marina"; 
    private static ConnectionSource connection = null; 
      
    public static ConnectionSource getConnection(){ 
          
        if(connection == null){ 
            try { 
                connection = new JdbcConnectionSource(url); 
            } catch (SQLException e) { 
                e.printStackTrace(); 
            } 
        } 
        return connection; 
    	
    } 
}